package Lab12;

import java.io.*;

public class exercise_12_1 {

    public static void main(String[] args) throws IOException

    {
String fileName="src/Lab12/Loan.java";
         DataInputStream in = new DataInputStream(new FileInputStream(fileName));

         BufferedReader d  = new BufferedReader(new InputStreamReader(in));

         BufferedInputStream input =new BufferedInputStream(new FileInputStream(fileName));

         String count;

         int r;

         int count_line=0,count_c=0,count_word1=0;

        

          while((count = d.readLine()) != null)

          {

          count_line++;

          if(!count.equals(""))

          {

               String[] words=count.trim().split(" ");

              for(String word:words)

              {

                  // System.out.println(word);

                   if(word!="\n"||word!=" ")

                   {

                       System.out.println(word);

                       count_word1++;

                   }

              }

          }

          }

         

          while((r=input.read())!=-1)

          {

          count_c++;

          }

         

          d.close();

          System.out.println("the loan.java has ");

          System.out.println(count_c+" characters");

          System.out.println(count_word1+" words");

          //System.out.println(count_word2+" words");

          System.out.println(count_line+" lines");

    }

}